/**
 * Created by wingsfrog on 2017/7/4.
 */
export class EarnestModel{
  id:number
  uuid:string
  customerId:number
  contractId:number
  apartmentId:number
  houseId:number
  type:number// ##账单类型  #1-房租账单，2-水费预约，3-电费预付 ,4-交定金
  content:string
  money:number
  status:number //#状态 1未付款 2 已付款 3 已过期 4 已使用
  statusName:string
  startTime:string
  endTime:string
  payWay:number//#支付方式 1-微信，2-支付宝，3-线下微信，4-线下支付宝，5-POS机
  payType:number
  payMoney:number
  payTime:string
  createTime:string
  createId:number
  updateTime:string
  updateId:number
  moneyDesc:string
  customerPhone:number
  customerName:string
  houseNo:string
  apartmentName:string
  buildingId:number
  buildingName:string
  depositPrice:number
  floor:number
  layoutName:string
  lightDark:boolean
  salePrice:number
  dueTime:any
  constructor(resp:any){
    this.id=resp.id;
    this.uuid=resp.uuid;
    this.customerId=resp.customerId;
    this.contractId=resp.contractId;
    this.apartmentId=resp.apartmentId;
    this.houseId=resp.houseId;
    this.type=resp.type;
    this.content=resp.content;
    this.money=resp.money;
    this.status=resp.status;
    this.statusName=resp.statusName;
    this.startTime=resp.startTime?resp.startTime.split(' ',1)[0]:resp.startTime;
    this.endTime=resp.endTime?resp.endTime.split(' ',1)[0]:resp.endTime;
    this.payType=resp.payType;
    this.payWay = resp.payWay;
    this.payMoney=resp.payMoney;
    this.payTime=resp.payTime?resp.payTime.split(' ',1)[0]:resp.payTime;
    this.createTime=resp.createTime?resp.createTime.split(' ',1)[0]:resp.createTime;
    this.createId=resp.createId,
    this.updateTime=resp.updateTime?resp.updateTime.split(' ',1)[0]:resp.updateTime;
    this.updateId=resp.updateId;
    this.moneyDesc=resp.moneyDesc;
    this.customerPhone=resp.customerPhone;
    this.customerName=resp.customerName;
    this.houseNo=resp.houseNo;
    this.apartmentName=resp.apartmentName;
    this.buildingId=resp.buildingId;
    this.buildingName=resp.buildingName;
    this.depositPrice = resp.depositPrice;
    this.floor = resp.floor;
    this.layoutName = resp.layoutName;
    this.lightDark = resp.lightDark;
    this.salePrice = resp.salePrice;
    this.dueTime = this.transFormDueTime(this.startTime);
  }
  transFormDueTime(date:any){
    let transDate=new Date(date);
    let year = transDate.getFullYear();
    let month:any = transDate.getMonth()+1;
    let day:any = transDate.getDate()+3;
    if(month<9){
      month = '0'+month;
    }
    if(day<9){
      day = '0'+day;
    }
    return year+'-'+month+'-'+day;
  }
}
